package wang.d2.interface_demo;

import java.util.ArrayList;

public class StudentOperatorImp1 implements StudentOperator{

    @Override
    public void printfallinfo(ArrayList<Student> Students) {
        System.out.println("----------全部学生信息-----------");
        for (int i = 0; i < Students.size(); i++) {
              Student student = Students.get(i);
            System.out.println("学生姓名：" + student.getName() + ",学生性别：" + student.getSex() + ",成绩：" + student.getScore());

        }
        System.out.println("----------------------------------------");


    }

    @Override
    public void printfallscore(ArrayList<Student> students){
        double counbt = 0.0;
        for (int i = 0; i < students.size(); i++) {
            Student s = students.get(i);
            counbt += s.getScore();
        }
        System.out.println("学生的平均成绩为：" + counbt / students.size());
    }
}
